/*
 * 通用组件样式
 * 定义可复用的组件样式和交互效果
 */

@import './variable.scss';

// 按钮组件样式
.btn {
  display: inline-flex;
  align-items: center;
  justify-content: center;
  padding: $base-spacing-md $base-spacing-xl;
  border: none;
  border-radius: $base-border-radius-md;
  font-size: $base-font-size-default;
  font-weight: 500;
  line-height: 1.5;
  text-decoration: none;
  cursor: pointer;
  transition: all 0.2s ease-in-out;
  box-shadow: $base-box-shadow-sm;

  &:hover {
    transform: translateY(-1px);
    box-shadow: $base-box-shadow-md;
  }

  &:active {
    transform: translateY(0);
    box-shadow: $base-box-shadow-sm;
  }

  &.btn-primary {
    background: $base-gradient-primary;
    color: $base-color-white;

    &:hover {
      background: linear-gradient(135deg, #5a67d8 0%, #6b46c1 100%);
    }
  }

  &.btn-success {
    background: $base-gradient-success;
    color: $base-color-white;

    &:hover {
      background: linear-gradient(135deg, #059669 0%, #047857 100%);
    }
  }

  &.btn-warning {
    background: $base-gradient-warning;
    color: $base-color-white;

    &:hover {
      background: linear-gradient(135deg, #d97706 0%, #b45309 100%);
    }
  }

  &.btn-danger {
    background: $base-gradient-danger;
    color: $base-color-white;

    &:hover {
      background: linear-gradient(135deg, #dc2626 0%, #b91c1c 100%);
    }
  }

  &.btn-outline {
    background: transparent;
    border: 2px solid $base-color-primary;
    color: $base-color-primary;

    &:hover {
      background: $base-color-primary;
      color: $base-color-white;
    }
  }

  &.btn-sm {
    padding: $base-spacing-sm $base-spacing-lg;
    font-size: $base-font-size-small;
  }

  &.btn-lg {
    padding: $base-spacing-lg $base-spacing-2xl;
    font-size: $base-font-size-big;
  }

  &:disabled {
    opacity: 0.6;
    cursor: not-allowed;
    transform: none !important;
    box-shadow: $base-box-shadow-sm !important;
  }
}

// 卡片组件样式
.card {
  background: $base-gradient-card;
  border: 1px solid $base-border-color-lighter;
  border-radius: $base-border-radius-lg;
  box-shadow: $base-box-shadow-sm;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);

  &:hover {
    background: $base-gradient-card-hover;
    box-shadow: $base-box-shadow-lg;
    transform: translateY(-2px);
  }

  .card-header {
    padding: $base-spacing-xl;
    border-bottom: 1px solid $base-border-color-extra-light;
    background: rgba(255, 255, 255, 0.5);
    border-radius: $base-border-radius-lg $base-border-radius-lg 0 0;

    .card-title {
      margin: 0;
      font-size: $base-font-size-bigger;
      font-weight: 600;
      color: $base-color-gray-800;
    }

    .card-subtitle {
      margin: $base-spacing-xs 0 0 0;
      font-size: $base-font-size-small;
      color: $base-color-gray-500;
    }
  }

  .card-body {
    padding: $base-spacing-xl;
  }

  .card-footer {
    padding: $base-spacing-lg $base-spacing-xl;
    border-top: 1px solid $base-border-color-extra-light;
    background: rgba(255, 255, 255, 0.3);
    border-radius: 0 0 $base-border-radius-lg $base-border-radius-lg;
  }
}

// 统计卡片样式
.stat-card {
  background: $base-gradient-card;
  border: 1px solid $base-border-color-lighter;
  border-radius: $base-border-radius-xl;
  padding: $base-spacing-2xl;
  text-align: center;
  transition: all 0.3s ease;
  backdrop-filter: blur(10px);
  position: relative;
  overflow: hidden;

  &::before {
    content: '';
    position: absolute;
    top: 0;
    left: 0;
    right: 0;
    height: 4px;
    background: $base-gradient-primary;
  }

  &:hover {
    transform: translateY(-4px);
    box-shadow: $base-box-shadow-xl;
    background: $base-gradient-card-hover;
  }

  .stat-icon {
    width: 48px;
    height: 48px;
    margin: 0 auto $base-spacing-lg;
    background: $base-gradient-primary;
    border-radius: $base-border-radius-full;
    display: flex;
    align-items: center;
    justify-content: center;
    color: $base-color-white;
    font-size: 24px;
  }

  .stat-value {
    font-size: 2rem;
    font-weight: 700;
    color: $base-color-gray-800;
    margin-bottom: $base-spacing-sm;
  }

  .stat-label {
    font-size: $base-font-size-small;
    color: $base-color-gray-500;
    font-weight: 500;
  }

  &.stat-success .stat-icon {
    background: $base-gradient-success;
  }

  &.stat-warning .stat-icon {
    background: $base-gradient-warning;
  }

  &.stat-danger .stat-icon {
    background: $base-gradient-danger;
  }
}

// 表格增强样式
.enhanced-table {
  .el-table {
    border-radius: $base-border-radius-lg;
    overflow: hidden;
    box-shadow: $base-box-shadow-sm;

    .el-table__header {
      th {
        background: linear-gradient(135deg, #f8fafc 0%, #e2e8f0 100%) !important;
        color: $base-color-gray-700 !important;
        font-weight: 600;
        border-bottom: 2px solid $base-color-primary;
        padding: $base-spacing-lg !important;
      }
    }

    .el-table__body {
      tr {
        transition: all 0.2s ease;

        &:hover {
          background-color: rgba(99, 102, 241, 0.05) !important;
        }

        td {
          padding: $base-spacing-lg !important;
          border-bottom: 1px solid $base-border-color-extra-light;
        }
      }
    }
  }
}

// 搜索框增强样式
.enhanced-search {
  .el-input {
    .el-input__wrapper {
      border-radius: $base-border-radius-lg;
      box-shadow: $base-box-shadow-sm;
      transition: all 0.3s ease;

      &:hover {
        box-shadow: $base-box-shadow-md;
      }

      &.is-focus {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        border-color: $base-color-primary;
      }
    }
  }

  .el-select {
    .el-input__wrapper {
      border-radius: $base-border-radius-lg;
      box-shadow: $base-box-shadow-sm;
      transition: all 0.3s ease;

      &:hover {
        box-shadow: $base-box-shadow-md;
      }

      &.is-focus {
        box-shadow: 0 0 0 3px rgba(99, 102, 241, 0.1);
        border-color: $base-color-primary;
      }
    }
  }
}

// 加载动画
.loading-spinner {
  display: inline-block;
  width: 20px;
  height: 20px;
  border: 3px solid rgba(99, 102, 241, 0.3);
  border-radius: 50%;
  border-top-color: $base-color-primary;
  animation: spin 1s ease-in-out infinite;
}

@keyframes spin {
  to {
    transform: rotate(360deg);
  }
}

// 渐变文字效果
.gradient-text {
  background: $base-gradient-primary;
  -webkit-background-clip: text;
  background-clip: text;
  -webkit-text-fill-color: transparent;
  font-weight: 600;
}

// 毛玻璃效果
.glass-effect {
  background: rgba(255, 255, 255, 0.25);
  backdrop-filter: blur(10px);
  border: 1px solid rgba(255, 255, 255, 0.18);
}

// 悬浮效果
.hover-lift {
  transition: all 0.3s ease;

  &:hover {
    transform: translateY(-4px);
    box-shadow: $base-box-shadow-lg;
  }
}

// 脉冲动画
.pulse {
  animation: pulse 2s cubic-bezier(0.4, 0, 0.6, 1) infinite;
}

@keyframes pulse {
  0%, 100% {
    opacity: 1;
  }
  50% {
    opacity: 0.5;
  }
}

// 淡入动画
.fade-in {
  animation: fadeIn 0.5s ease-in-out;
}

@keyframes fadeIn {
  from {
    opacity: 0;
    transform: translateY(20px);
  }
  to {
    opacity: 1;
    transform: translateY(0);
  }
}

// 滑入动画
.slide-in-right {
  animation: slideInRight 0.5s ease-out;
}

@keyframes slideInRight {
  from {
    opacity: 0;
    transform: translateX(30px);
  }
  to {
    opacity: 1;
    transform: translateX(0);
  }
}